package com.bosssoft.trainee.nontax.controller;

import com.bosssoft.trainee.nontax.common.result.Result;
import com.bosssoft.trainee.nontax.entity.vo.RoleVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @author Luo Wenlong
 * @date 2022-06-30 22:11
 * @description:suthorize controller 的 consumer
 * @version:
 */
@RestController
public class AuthorizeConsumerController {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private static final String REST_URL_PREFIX = "http://nontax-provider"; // NONTAX-PROVIDER localhost:8001

    @ResponseBody
    @RequestMapping("/consumer/role/getAll")
    public Result<List<RoleVo>> getAllRoles() {
        return restTemplate.getForObject(REST_URL_PREFIX + "/role/getAll",Result.class);
    }
}
